home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / amiga.programming / comp.sys.amiga.programmer_10958_000071.msg < prev    next >
Encoding:
Text File  |  1994-11-27  |  2.5 KB  |  55 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!howland.reston.ans.net!xlink.net!rz.uni-karlsruhe.de!stepsun.uni-kl.de!uklirb.informatik.uni-kl.de!feck
  3. From: feck@informatik.uni-kl.de (Christoph Feck IRZ)
  4. Subject: Re: Calling libraries from boopsi objects
  5. Message-ID: <1994May17.194729@informatik.uni-kl.de>
  6. Sender: news@uklirb.informatik.uni-kl.de (Unix-News-System)
  7. Nntp-Posting-Host: uklira.informatik.uni-kl.de
  8. Organization: University of Kaiserslautern, Germany
  9. References:  <Cpwzx1.3A9@undergrad.math.uwaterloo.ca>
  10. Date: Tue, 17 May 1994 17:47:29 GMT
  11. Lines: 43
  12.  
  13. In article <Cpwzx1.3A9@undergrad.math.uwaterloo.ca>, clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves) writes:
  14. > I'm working on a simple boopsi gadget, and I'm stuck on one thing:
  15. > Where do I store library bases, and when should I get them?
  16.  
  17. Put a pointer to your global (per-class) data in cl->cl_UserData.
  18. Open all the libraries before you are going to make your class
  19. handle available.
  20.  
  21. > The reason I'm asking is this: the dispatcher is called from Intuition's
  22. > context, while the function that creates the class is called from the
  23. > application's context. Theoretically, and library bases I get from the
  24. > app's context might be invalid in Intuition's context, right? (this is the
  25. > "sharing library bases" issue)
  26.  
  27. I'd say that exec, graphics, intuition, utility and layers
  28. are safe to share (Commodore does it, too).  If your gadget
  29. needs other libraries, well, open them in the dispatcher,
  30. BUT also open them in your class initialization just to make
  31. sure they are in memory (and stay there until the class is
  32. freed).  If OpenLibrary() would need to load, you could
  33. end up creating a deadlock, when ramlib puts a 'Please
  34. insert LIBS:' requester (which you can't disable because
  35. tasks like input.device don't have pr_WindowPtr...)
  36.  
  37. > Since I'll probably always be using the libraries within the dispatcher's
  38. > context (ie: Intuition's) I guess I should open the lib's in the
  39. > dispatcher, say in the OM_NEW method.
  40.  
  41. No!  The OM_NEW method will be called on the applications
  42. process, but the GM_HITTEST will be called from input.device.
  43. You will have to open them whenever you need them, not just
  44. once in the object creation (which means the library pointers
  45. are local variables in your dispatcher function, and not
  46. stored in either per-class or per-object data).
  47.  
  48. If you have further questions, feel free to ask.
  49.  
  50. Mr. BOOPSI :)
  51.  
  52. 3k// Christoph Feck, TowerSystems - BOOPSI Class Development
  53. \X/ Amiga - Intuition inside.
  54.